//
//  BwtNativeAdView.m
//  bwt_ad_flutter
//
//  Created by 帅 on 2025/6/24.
//

#import "BwtNativeAdView.h"
#import "BwtNativeAdManager.h"
@implementation BwtNativeAdView


//在这里只是创建了一个UILabel
-(instancetype)initWithWithFrame:(CGRect)frame viewIdentifier:(int64_t)viewId arguments:(id)args binaryMessenger:(NSObject<FlutterBinaryMessenger> *)messenger{
    if ([args isKindOfClass:[NSDictionary class]]) {
        NSDictionary *params = args;
        NSString *adId = params[@"adId"];
        
        if (adId) {
            BwtNativeAdManager *nativeAdManager = [BwtNativeAdManager getBwtNativeAdManager];
            self.nativeAdView = [nativeAdManager getNativeAdView:adId];
        }
    }
    return self;
}
 
- (nonnull UIView *)view {
    if (_nativeAdView) {
        return _nativeAdView;
    }
    return [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
}

@end
